package com.hyq.learn.api.enumtype;

import com.hyq.learn.mybatis.config.BaseEnum;

/**
 * 枚举类型的name与配置文件中的数据源name需一致，否则不会映射到对饮枚举类中
 *
 * @author heyuqin
 * @date 2024/5/29 19:16
 */
public enum DatasourceType implements BaseEnum<DatasourceType, String> {
    MASTER("master"),
    BASE("base"),
    ;

    private final String value;

    DatasourceType(String value) {
        this.value = value;
    }

    @Override
    public String getValue() {
        return value;
    }

    public static DatasourceType parseByValue(String value) {
        for (DatasourceType datasourceType : values()) {
            if (datasourceType.value.equals(value)) {
                return datasourceType;
            }
        }
        return null;
    }
}
